<?php 

class App_codecs extends MY_Library {

function __construct()
{
	parent::__construct();

	$this->PACKAGE->routing->load->library('codecs/codecs');
}


public function generate_menu($field_name, $selected_codecs = false, $css = NULL)
{
	if($selected_codecs == false)
	{
		$selected_codecs = array();		
	}

	$codecs = $this->PACKAGE->routing->codecs->get_active_codecs();
	
	$text = '';
	foreach($codecs as $codec)
	{
		$text .= "<span>
					<input type='checkbox' name='data[{$field_name}][{$codec['codec_field']}]' class='{$css}' value='1' ";
		
		if(in_array($codec['codec_field'],$selected_codecs))
		{
		$text .= "checked='checked'";
		}
		$text .= ">
					<label>{$codec['codec_name']}</label>
				  </span>";
	}
	
	
	return $text;
	
}

}
?>